/*
 *  This code is adapted from the work of Michael Nachbaur 
 *  by Simon Madine of The Angry Robot Zombie Factory
 *   - Converted to Cordova 1.6.1 by Joseph Stuhr.
 *  2012-04-19
 *  MIT licensed
 *
 */

/*
 * Temporary Scope to contain the plugin.
 *  - More information here:
 *     https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md
 */
(function(){

    /* Get local ref to global PhoneGap/Cordova/cordova object for exec function.
     - This increases the compatibility of the plugin. */
    var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks

    /*
     * This class exposes the iPhone 'icon Echo' functionality to JavaScript
     * to add a number (with a red background) to each icon.
     */
    function Echo() { }

    /**
     * Positive integer sets the Echo amount, 0 or negative removes it.
     */
    Echo.prototype.echo = function(options) {
        var win = function(result){
           alert('win: ' +result[0]);
        }
        var fail = function(result){
           alert('fail: ' +result[0]);
        }
        cordovaRef.exec(win,fail,'Echo','echo',[ options]);
    };


    if (typeof cordovaRef !== "undefined")
    {



            if(!window.plugins) {
                window.plugins = {};
            }
            if(!window.plugins.Echo) {
                window.plugins.Echo = new Echo();
            }


    }

})(); /* End of Temporary Scope. */